<?php
namespace app\food\model;

use think\Model;

class Category extends Model
{
    //自定义初始化
    protected function initialize()
    {
        //需要调用`Model`的`initialize`方法
        parent::initialize();
    }

    // 定义全局的查询范围
    protected function base($query)
    {
        $query->where('type','food');
    }
}